package org.cshoo.sys.business
{
	import hessian.client.HessianService;
	
	import mx.rpc.AsyncToken;
	import mx.rpc.IResponder;
	
	import org.cshoo.common.business.ServiceLocator;
	import org.cshoo.sys.model.vo.User;
	
	public class UserDelegate
	{
		public var serviceLocator:ServiceLocator =  ServiceLocator.getInstance();
		
		public var _service:HessianService;
		private var _responder:IResponder;
		
		public function UserDelegate(responder:IResponder)
		{
			_service = serviceLocator.userService;
			this._responder=responder;
		}
		
		public function login(user:User):void{
			var call:Object;
			call = _service.getOperation("login").send(user);
			call.addResponder(_responder);
		}
		
		public function logout():void{
			var call:Object;
			call = _service.getOperation("logout").send();
			call.addResponder(_responder);
		}
		
		public function addUser(user:User):void{
			var call:Object;
			call = _service.getOperation("addUser").send(user);
			call.addResponder(_responder);
		}
		
		public function findUserList(user:User):void{
			var asyncToken:AsyncToken　=　_service.getOperation("findUserList").send(user);
			asyncToken.addResponder(_responder);
		}
	}
}